using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class MedicationPlanMap : EntityTypeConfiguration<MedicationPlan>
	{
		public MedicationPlanMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			// Table & Column Mappings
			this.ToTable("MedicationPlans");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.PhysicianNoteId).HasColumnName("PhysicianNoteId");

			// Relationships
			this.HasOptional(t => t.PhysicianNote)
				.WithMany(t => t.MedicationPlans)
				.HasForeignKey(d => d.PhysicianNoteId);
				
		}
	}
}

